package characters;

public class Player {
    String name;
    String type;
    double posX;
    double posY;
    double vecX;
    double vecY;
    double bodyDir;
    double neckDir;
//    String visionType;
//    String visionRange;
    double stamina;
    String focusObject;

    public Player(String origin) {
        String[] tmp = origin.split("\\) | \\(");
        for (int i = 0; i < tmp.length; i++) {
            tmp[i] = tmp[i].replaceAll("\\)|\\(", "");
            tmp[i] = tmp[i].trim();
//            System.out.println(tmp[i]);
            if (!tmp[i].isEmpty() | tmp[i] != null) {
                if (tmp[i].startsWith("l") | tmp[i].startsWith("r")) {
                    this.name = tmp[i];
                    continue;
                } else if (tmp[i].startsWith("v")) {
                    //TODO: I'm not sure if "view" is needed, you can complete this yourself;
                } else if (tmp[i].startsWith("s")) {
                    String[] tmp1 = tmp[i].split("\\s+");
                    this.stamina = Double.parseDouble(tmp1[1]);
                    continue;
                    //TODO: I think we only need to know players remaining stamina, you can complete this;
                } else if (tmp[i].startsWith("f")) {
                    this.focusObject = tmp[i].substring(2);
                    continue;
                } else if (tmp[i].startsWith("c")) {
                    continue;
                    //
                } else {
                    String[] tmp2 = tmp[i].split("\\s+");
                    this.type = tmp2[1];
                    this.posX = Double.parseDouble(tmp2[2]);
                    this.posY = Double.parseDouble(tmp2[3]);
                    this.vecX = Double.parseDouble(tmp2[4]);
                    this.vecY = Double.parseDouble(tmp2[5]);
                    this.bodyDir = Double.parseDouble(tmp2[6]);
                    this.neckDir = Double.parseDouble(tmp2[7]);
                    continue;
                }
            }
        }
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getType() {
        return type;
    }

    public void setType(String type) {
        this.type = type;
    }

    public double getPosX() {
        return posX;
    }

    public void setPosX(double posX) {
        this.posX = posX;
    }

    public double getPosY() {
        return posY;
    }

    public void setPosY(double posY) {
        this.posY = posY;
    }

    public double getVecX() {
        return vecX;
    }

    public void setVecX(double vecX) {
        this.vecX = vecX;
    }

    public double getVecY() {
        return vecY;
    }

    public void setVecY(double vecY) {
        this.vecY = vecY;
    }

    public double getBodyDir() {
        return bodyDir;
    }

    public void setBodyDir(double bodyDir) {
        this.bodyDir = bodyDir;
    }

    public double getNeckDir() {
        return neckDir;
    }

    public void setNeckDir(double neckDir) {
        this.neckDir = neckDir;
    }

    public double getStamina() {
        return stamina;
    }

    public void setStamina(double stamina) {
        this.stamina = stamina;
    }

    public String getFocusObject() {
        return focusObject;
    }

    public void setFocusObject(String focusObject) {
        this.focusObject = focusObject;
    }

}
